//
//  RequestCMD.m
//  easyTaxi
//
//  Created by ellenpage on 12-12-6.
//  Copyright (c) 2012年 ellenpage. All rights reserved.
//

#import "Constant.h"
#import "PassValueClass.h"
#import "RequestCMD.h"
#import "GetPhoneInfo.h"
#import "XMLWriter.h"

@implementation RequestCMD : NSObject 

+ (NSString *)requestCMD:(NSInteger)cmdInt
{
    NSString *string = nil;
    switch (cmdInt)
    {
        case kUserLogIn://1001---用户登录
        {
            NSString *login     = [NSString stringWithFormat:@"%d",kUserLogIn];
            NSString *version   = [PassValueClass sharedIntance].versionStr;
            NSString *lngStr    = [PassValueClass sharedIntance].lngStr;
            NSString *latStr    = [PassValueClass sharedIntance].latStr;
            NSString *cityStr   = [PassValueClass sharedIntance].cityStr;
            NSString *IMSIStr   = [PassValueClass sharedIntance].IMSIStr;
            NSString *channelNo = [PassValueClass sharedIntance].channellNoStr;
            
            NSString *deviceId   = @"deviceid";
            NSString *timeNow    = [GetPhoneInfo getCurrentTimeStamp];
            NSString *tele       = [[NSUserDefaults standardUserDefaults] objectForKey:kTelephone];
            
            NSString *areaCode   = [PassValueClass sharedIntance].areaCode;
            NSString *operateStr = [PassValueClass sharedIntance].operatorStr;

            string=[NSString stringWithFormat:@"<PROTOCOL><VER>%@</VER><CMD>%@</CMD>"
                              @"<IMSI>%@</IMSI><DEVICEID>%@</DEVICEID>"
                              @"<TELEPHONENO>%@</TELEPHONENO><LONGITUDE>%@</LONGITUDE><LATITUDE>%@</LATITUDE><AREACODE>%@</AREACODE>"
                              @"<CHANNELNO>%@</CHANNELNO><BELONGAREA>%@</BELONGAREA>"
                              @"<USERTYPE>2</USERTYPE><OPERATOR>%@</OPERATOR>"
                              @"<TIMESTAMPS>%@</TIMESTAMPS></PROTOCOL>",version,login,IMSIStr,deviceId,tele,lngStr,latStr,areaCode,channelNo,cityStr,operateStr,timeNow];
            NSLog(@"%@",string);
            return string;
        }
            break;
            
        case kLastBill:
        {
            NSString *CMDStr       = [NSString stringWithFormat:@"%d",kLastBill];
            NSString *versionStr   = [PassValueClass sharedIntance].versionStr;
            NSString *IMSIStr      = [PassValueClass sharedIntance].IMSIStr;
            NSString *timeStampStr = [GetPhoneInfo getCurrentTimeStamp];
                    
            XMLWriter *xmlWriter = [[XMLWriter alloc] init];
            
            [xmlWriter writeStartElement:kProtocol];
            
            [xmlWriter writeStartElement:kVer];
            [xmlWriter writeCharacters:versionStr];
            [xmlWriter writeEndElement:kVer];
            
            [xmlWriter writeStartElement:kCmd];
            [xmlWriter writeCharacters:CMDStr];
            [xmlWriter writeEndElement:kCmd];
            
            [xmlWriter writeStartElement:kIMSI];
            [xmlWriter writeCharacters:IMSIStr];
            [xmlWriter writeEndElement:kIMSI];
                    
            [xmlWriter writeStartElement:kTimeStamps];
            [xmlWriter writeCharacters:timeStampStr];
            [xmlWriter writeEndElement:kTimeStamps];
            
            [xmlWriter writeEndElement:kProtocol];
            
            NSMutableString *str = [xmlWriter toString];
            string = str;
//            NSLog(@"%@",string);
            return string;
        }
            break;
            
        case kUserPulseRecord://1011---心跳
        {
            NSString *versionStr   = [PassValueClass sharedIntance].versionStr;
            NSString *timeStampStr = [GetPhoneInfo   getCurrentTimeStamp];
            NSString *latStr       = [PassValueClass sharedIntance].latStr;
            NSString *lonStr       = [PassValueClass sharedIntance].lngStr;//读取经纬度
            NSString *IMSIStr      = [PassValueClass sharedIntance].IMSIStr;
            NSString *areaCodeStr  = [PassValueClass sharedIntance].areaCode;
 
             string =[NSString stringWithFormat:@"<PROTOCOL><VER>%@</VER><CMD>1011</CMD>"
                                  @"<IMSI>%@</IMSI><LONGITUDE>%@</LONGITUDE>"
                                  @"<LATITUDE>%@</LATITUDE><TRAFFIC>100</TRAFFIC>"@"<AREACODE>%@</AREACODE>"
                                  @"<TIMESTAMPS>%@</TIMESTAMPS></PROTOCOL>",versionStr,IMSIStr,lonStr,latStr,areaCodeStr,timeStampStr];
//            NSLog(@"%@",string);
            return string;
        }
            break;
            
        case kUserInfo://1003---个人信息
        {
            NSString *CMDStr       = [NSString stringWithFormat:@"%d",kUserInfo];
            NSString *versionStr   = [PassValueClass sharedIntance].versionStr;
            NSString *timeStampStr = [GetPhoneInfo getCurrentTimeStamp];
            NSString *IMSIStr      = [PassValueClass sharedIntance].IMSIStr;
            NSString *cityStr      = [PassValueClass sharedIntance].cityStr;
            
            string = [NSString stringWithFormat:@"<PROTOCOL><VER>%@</VER><CMD>%@</CMD>"
                                @"<IMSI>%@</IMSI><BELONGAREA>%@</BELONGAREA>"
                                @"<TIMESTAMPS>%@</TIMESTAMPS></PROTOCOL>",versionStr,CMDStr,IMSIStr,cityStr,timeStampStr];
            return string;
        }
            break;
            
        case kPublicInfo://1005---公共信息
        {
            NSString *CMDStr       = [NSString stringWithFormat:@"%d",kPublicInfo];
            NSString *versionStr   = [PassValueClass sharedIntance].versionStr;
            NSString *areaCode     = [PassValueClass sharedIntance].areaCode;
            NSString *IMSIStr      = [PassValueClass sharedIntance].IMSIStr;
            NSString *cityStr      = [PassValueClass sharedIntance].cityStr;
            NSString *timeStampStr = [GetPhoneInfo getCurrentTimeStamp];

            NSString *string=[NSString stringWithFormat:@"<PROTOCOL><VER>%@</VER><CMD>%@</CMD><AREACODE>%@</AREACODE>"@"<IMSI>%@</IMSI><BELONGAREA>%@</BELONGAREA>"@"<TIMESTAMPS>%@</TIMESTAMPS></PROTOCOL>",versionStr,CMDStr,areaCode,IMSIStr,cityStr,timeStampStr];
            return string;
        }
            break;
            
            case kParameters://3003---获取参数
        {
            NSString *CMDStr       = [NSString stringWithFormat:@"%d",kParameters];
            NSString *versionStr   = [PassValueClass sharedIntance].versionStr;
            NSString *IMSIStr      = [PassValueClass sharedIntance].IMSIStr;
            NSString *timeStampStr = [GetPhoneInfo getCurrentTimeStamp];

            string=[NSString stringWithFormat:@"<PROTOCOL><VER>%@</VER><CMD>%@</CMD>"
                              @"<IMSI>%@</IMSI>"
                              @"<TIMESTAMPS>%@</TIMESTAMPS></PROTOCOL>",versionStr,CMDStr,IMSIStr,timeStampStr];
//            NSLog(@"%@",string);
            return string;
        }
            break;
            
        case kCallTaxiRequest://1007--打车申请
        {
            NSString *CMDStr       = [NSString stringWithFormat:@"%d",kCallTaxiRequest];
            NSString *versionStr   = [PassValueClass sharedIntance].versionStr;
            NSString *IMSIStr      = [PassValueClass sharedIntance].IMSIStr;
            NSString *timeStampStr = [GetPhoneInfo getCurrentTimeStamp];
            
            NSString *lngStr     = [PassValueClass sharedIntance].lngStr;
            NSString *latStr     = [PassValueClass sharedIntance].latStr;
            NSString *cityStr    = [PassValueClass sharedIntance].cityStr;
            
            NSString *areaCode   = [PassValueClass sharedIntance].areaCode;
            
            NSString *distance   = [NSString stringWithFormat:@"%d",[PassValueClass sharedIntance].distance];
            
            NSString *curStr     = [PassValueClass sharedIntance].startAddress;
            
            BMKPoiInfo *tmpPoi = [PassValueClass sharedIntance].poi;
            NSString *desStr   = tmpPoi.name;
            NSString *lngStr_Des = [NSString stringWithFormat:@"%f",tmpPoi.pt.longitude];
            NSString *latStr_Des = [NSString stringWithFormat:@"%f",tmpPoi.pt.latitude];            
            
            NSString *daCheDouStr = [PassValueClass sharedIntance].costDaCheDou;
            NSString *typeStr     = [PassValueClass sharedIntance].typeStr;
            
            XMLWriter *xmlWriter = [[XMLWriter alloc] init];
            
            [xmlWriter writeStartElement:kProtocol];
            
            [xmlWriter writeStartElement:kVer];
            [xmlWriter writeCharacters:versionStr];
            [xmlWriter writeEndElement:kVer];
            
            [xmlWriter writeStartElement:kCmd];
            [xmlWriter writeCharacters:CMDStr];
            [xmlWriter writeEndElement:kCmd];
            
            [xmlWriter writeStartElement:kIMSI];
            [xmlWriter writeCharacters:IMSIStr];
            [xmlWriter writeEndElement:kIMSI];
            
            [xmlWriter writeStartElement:kAreaCode];
            [xmlWriter writeCharacters:areaCode];
            [xmlWriter writeEndElement:kAreaCode];
            
            [xmlWriter writeStartElement:kCurLongitude];
            [xmlWriter writeCharacters:lngStr];
            [xmlWriter writeEndElement:kCurLongitude];
            
            [xmlWriter writeStartElement:kCurLatitude];
            [xmlWriter writeCharacters:latStr];
            [xmlWriter writeEndElement:kCurLatitude];

            [xmlWriter writeStartElement:kDesLongitude];
            [xmlWriter writeCharacters:lngStr_Des];
            [xmlWriter writeEndElement:kDesLongitude];
            
            [xmlWriter writeStartElement:kDesLatitude];
            [xmlWriter writeCharacters:latStr_Des];
            [xmlWriter writeEndElement:kDesLatitude];

            [xmlWriter writeStartElement:kDistance];
            [xmlWriter writeCharacters:distance];
            [xmlWriter writeEndElement:kDistance];

            [xmlWriter writeStartElement:kBelongAera];
            [xmlWriter writeCharacters:cityStr];
            [xmlWriter writeEndElement:kBelongAera];

            [xmlWriter writeStartElement:kCurName];
            [xmlWriter writeCharacters:curStr];
            [xmlWriter writeEndElement:kCurName];
            
            [xmlWriter writeStartElement:kDesName];
            [xmlWriter writeCharacters:desStr];
            [xmlWriter writeEndElement:kDesName];

            [xmlWriter writeStartElement:kCoin];
            [xmlWriter writeCharacters:daCheDouStr];
            [xmlWriter writeEndElement:kCoin];
            
            [xmlWriter writeStartElement:kType];
            [xmlWriter writeCharacters:typeStr];
            [xmlWriter writeEndElement:kType];
            
            [xmlWriter writeStartElement:kTimeStamps];
            [xmlWriter writeCharacters:timeStampStr];
            [xmlWriter writeEndElement:kTimeStamps];
            
            [xmlWriter writeEndElement:kProtocol];
            
            NSMutableString *str = [xmlWriter toString];
            string = str;
            NSLog(@"1007 -- %@",string);
            return string;
            
        }
            break;
            
        case kUserCancelTaxi://1014---用户取消打车
        {
            NSString *CMDStr       = [NSString stringWithFormat:@"%d",kUserCancelTaxi];
            NSString *versionStr   = [PassValueClass sharedIntance].versionStr;
            NSString *IMSIStr      = [PassValueClass sharedIntance].IMSIStr;
            NSString *timeStampStr = [GetPhoneInfo getCurrentTimeStamp];
            NSString *orderNo      = [NSString stringWithFormat:@"%d",[PassValueClass sharedIntance].orderNO];
            
            XMLWriter *xmlWriter = [[XMLWriter alloc] init];
            
            [xmlWriter writeStartElement:kProtocol];
            
            [xmlWriter writeStartElement:kVer];
            [xmlWriter writeCharacters:versionStr];
            [xmlWriter writeEndElement:kVer];
            
            [xmlWriter writeStartElement:kCmd];
            [xmlWriter writeCharacters:CMDStr];
            [xmlWriter writeEndElement:kCmd];
            
            [xmlWriter writeStartElement:kIMSI];
            [xmlWriter writeCharacters:IMSIStr];
            [xmlWriter writeEndElement:kIMSI];
            
            [xmlWriter writeStartElement:kRequestID];
            [xmlWriter writeCharacters:orderNo];
            [xmlWriter writeEndElement:kRequestID];
            
            [xmlWriter writeStartElement:kTimeStamps];
            [xmlWriter writeCharacters:timeStampStr];
            [xmlWriter writeEndElement:kTimeStamps];
            
            [xmlWriter writeEndElement:kProtocol];
            
            NSMutableString *str = [xmlWriter toString];
            string = str;
            NSLog(@"%@",string);
            return string;
        }
            break;
            
        case kUserSetting://1015--用户设置
        {
            NSString *CMDStr       = [NSString stringWithFormat:@"%d",kUserSetting];
            NSString *versionStr   = [PassValueClass sharedIntance].versionStr;
            NSString *IMSIStr      = [PassValueClass sharedIntance].IMSIStr;
            NSString *timeStampStr = [GetPhoneInfo getCurrentTimeStamp];

            NSString *phoneStr   = [PassValueClass sharedIntance].teleNumStr;
            NSString *nameStr    = [PassValueClass sharedIntance].nickNameStr;
            NSString *sexStr     = [PassValueClass sharedIntance].sexStr;
            NSString *arrangeStr = [PassValueClass sharedIntance].arrangeStr;
            
            NSString *string     = [NSString stringWithFormat:@"<PROTOCOL><VER>%@</VER><CMD>%@</CMD>"
                                  @"<IMSI>%@</IMSI><NICK>%@</NICK><SEX>%@</SEX><BIRTHDATE>1985-01-22</BIRTHDATE>"
                                  @"<TELEPHONENO>%@</TELEPHONENO>"
                                  @"<ARRANGE>%@</ARRANGE>"
                                  @"<TIMESTAMPS>%@</TIMESTAMPS></PROTOCOL>",versionStr,CMDStr,IMSIStr,nameStr,sexStr,phoneStr,arrangeStr,timeStampStr];
            return string;
        }
            break;
            
        case kUserLocation://1019--用户位置上报
        {
            NSString *CMDStr       = [NSString stringWithFormat:@"%d",kUserLocation];
            NSString *versionStr   = [PassValueClass sharedIntance].versionStr;
            NSString *IMSIStr      = [PassValueClass sharedIntance].IMSIStr;
            NSString *timeStampStr = [GetPhoneInfo getCurrentTimeStamp];
           
            NSString *tmpLngStr    = [PassValueClass sharedIntance].tmpLngStr;
            NSString *tmpLatStr    = [PassValueClass sharedIntance].tmpLatStr;
            NSLog(@"%d",[PassValueClass sharedIntance].orderNO);
            NSString *orderNoStr   = [NSString stringWithFormat:@"%d",[PassValueClass sharedIntance].orderNO];
            
            NSString *string=[NSString stringWithFormat:@"<PROTOCOL><VER>%@</VER><CMD>%@</CMD>"
                             @"<IMSI>%@</IMSI><LONGITUDE>%@</LONGITUDE>"
                             @"<LATITUDE>%@</LATITUDE><REQUESTID>%@</REQUESTID>"
                             @"<TIMESTAMPS>%@</TIMESTAMPS></PROTOCOL>",versionStr,CMDStr,IMSIStr,tmpLngStr,tmpLatStr,orderNoStr,timeStampStr];
            NSLog(@"1019%@",string);
            return string;
        }
            break;
            
        case kNearDrivers://3001---周围司机列表
        {
            NSString *lngStr;
            NSString *latStr;
            NSString *cityStr;
            NSString *areaCode;
            
            if (isTiYanMoShiOk)
            {
                lngStr       = [PassValueClass sharedIntance].lngStr_TiYanMoShi;
                latStr       = [PassValueClass sharedIntance].latStr_TiYanMoShi;
                cityStr      = [PassValueClass sharedIntance].cityStr_TiYanMoShi;
                areaCode     = [PassValueClass sharedIntance].areaCode_TiYanMoShi;
            }
            
            else
            {
                lngStr       = [PassValueClass sharedIntance].lngStr;
                latStr       = [PassValueClass sharedIntance].latStr;
                cityStr      = [PassValueClass sharedIntance].cityStr;
                areaCode     = [PassValueClass sharedIntance].areaCode;
            }
            
            NSString *CMDStr       = [NSString stringWithFormat:@"%d",kNearDrivers];
            NSString *versionStr   = [PassValueClass sharedIntance].versionStr;
            NSString *IMSIStr      = [PassValueClass sharedIntance].IMSIStr;
            NSString *timeStampStr = [GetPhoneInfo getCurrentTimeStamp];

            NSString *string=[NSString stringWithFormat:@"<PROTOCOL><VER>%@</VER><CMD>%@</CMD>"
                              @"<IMSI>%@</IMSI><BELONGAREA>%@</BELONGAREA><LONGITUDE>%@</LONGITUDE>"
                              @"<LATITUDE>%@</LATITUDE><AREACODE>%@</AREACODE><TIMESTAMPS>%@</TIMESTAMPS></PROTOCOL>",versionStr,CMDStr,IMSIStr,cityStr,lngStr,latStr,areaCode,timeStampStr];
            return string;
        }
            break;
            
        case kAddressListTimeStamp://1078地址簿时间更新
        {
            NSString *CMDStr       = [NSString stringWithFormat:@"%d",kAddressListTimeStamp];
            NSString *versionStr   = [PassValueClass sharedIntance].versionStr;
            NSString *IMSIStr      = [PassValueClass sharedIntance].IMSIStr;
            NSString *timeStampStr = [GetPhoneInfo getCurrentTimeStamp];
            
            NSString *string = [NSString stringWithFormat:@"<PROTOCOL><VER>%@</VER><CMD>%@</CMD>"@"<IMSI>%@</IMSI>"@"<TIMESTAMPS>%@</TIMESTAMPS></PROTOCOL>",versionStr,CMDStr,IMSIStr,timeStampStr];
            return string;
        }
            break;
            
        case kAddressList://1065---地址簿
        {
            NSString *CMDStr       = [NSString stringWithFormat:@"%d",kAddressList];
            NSString *versionStr   = [PassValueClass sharedIntance].versionStr;
            NSString *IMSIStr      = [PassValueClass sharedIntance].IMSIStr;
            NSString *timeStampStr = [GetPhoneInfo getCurrentTimeStamp];
            
            NSString *string=[NSString stringWithFormat:@"<PROTOCOL><VER>%@</VER><CMD>%@</CMD>"@"<IMSI>%@</IMSI>"@"<TIMESTAMPS>%@</TIMESTAMPS></PROTOCOL>",versionStr,CMDStr,IMSIStr,timeStampStr];
            
            return string;
        }
            break;
            
        case kAddressListUpdate://1067----更新地址簿
        {
            NSString *CMDStr       = [NSString stringWithFormat:@"%d",kAddressListUpdate];
            NSString *versionStr   = [PassValueClass sharedIntance].versionStr;
            NSString *IMSIStr      = [PassValueClass sharedIntance].IMSIStr;
            NSString *timeStampStr = [GetPhoneInfo getCurrentTimeStamp];
            NSString *timeStr      = [GetPhoneInfo getCurrentTimeStamp];
            
            XMLWriter *xmlWriter = [[XMLWriter alloc] init];
            
            [xmlWriter writeStartElement:kProtocol];

            [xmlWriter writeStartElement:kVer];
            [xmlWriter writeCharacters:versionStr];
            [xmlWriter writeEndElement:kVer];
            
            [xmlWriter writeStartElement:kCmd];
            [xmlWriter writeCharacters:CMDStr];
            [xmlWriter writeEndElement:kCmd];
            
            [xmlWriter writeStartElement:kTime];
            [xmlWriter writeCharacters:timeStr];
            [xmlWriter writeEndElement:kTime];
            
            NSMutableDictionary *addressbookDict =[NSMutableDictionary dictionaryWithDictionary:[[NSUserDefaults standardUserDefaults]objectForKey:kMyAddressBook]];
            NSArray *addressbookArray = [addressbookDict objectForKey:kAddressBookArray];
            
            [xmlWriter writeStartElement:kAddressListKey];
            
            for (int i = 0; i < addressbookArray.count; i++)
            {
                NSDictionary *dict = [addressbookArray objectAtIndex:i];
                NSLog(@"%@",dict);
                
                NSString *poiStr  = [dict objectForKey:kPoiName];
                NSString *codeStr = [dict objectForKey:kAreaCode];
                NSString *nameStr = [dict objectForKey:kAddressName];
                NSString *latStr  = [dict objectForKey:kLatitude];
                NSString *longStr = [dict objectForKey:kLongitude];
                NSString *timeStr = [dict objectForKey:kLastTime];
                
                [xmlWriter writeStartElement:kAddressKey];
                
                [xmlWriter writeStartElement:kAddressName];
                [xmlWriter writeCharacters:nameStr];
                [xmlWriter writeEndElement:kAddressName];
                
                [xmlWriter writeStartElement:kPoiName];
                [xmlWriter writeCharacters:poiStr];
                [xmlWriter writeEndElement:kPoiName];

                [xmlWriter writeStartElement:kLongitude];
                [xmlWriter writeCharacters:longStr];
                [xmlWriter writeEndElement:kLongitude];
                
                [xmlWriter writeStartElement:kLatitude];
                [xmlWriter writeCharacters:latStr];
                [xmlWriter writeEndElement:kLatitude];

                [xmlWriter writeStartElement:kAreaCode];
                [xmlWriter writeCharacters:codeStr];
                [xmlWriter writeEndElement:kAreaCode];

                [xmlWriter writeStartElement:kLastTime];
                [xmlWriter writeCharacters:timeStr];
                [xmlWriter writeEndElement:kLastTime];

                [xmlWriter writeEndElement:kAddressKey];
            }
            [xmlWriter writeEndElement:kAddressListKey];

            [xmlWriter writeStartElement:kIMSI];
            [xmlWriter writeCharacters:IMSIStr];
            [xmlWriter writeEndElement:kIMSI];
            
            [xmlWriter writeStartElement:kTimeStamps];
            [xmlWriter writeCharacters:timeStampStr];
            [xmlWriter writeEndElement:kTimeStamps];

            [xmlWriter writeEndElement:kProtocol];
            
            NSMutableString *str = [xmlWriter toString];
            string = str;
//            NSLog(@"%@",str);
            return string;
        }
            break;
            
            case kQuaryLottary://1072----查询中奖列表
        {
            NSString *CMDStr       = [NSString stringWithFormat:@"%d",kQuaryLottary];
            NSString *versionStr   = [PassValueClass sharedIntance].versionStr;
            NSString *IMSIStr      = [PassValueClass sharedIntance].IMSIStr;
            NSString *timeStampStr = [GetPhoneInfo getCurrentTimeStamp];

            XMLWriter *xmlWriter = [[XMLWriter alloc] init];
            
            [xmlWriter writeStartElement:kProtocol];
            
            [xmlWriter writeStartElement:kVer];
            [xmlWriter writeCharacters:versionStr];
            [xmlWriter writeEndElement:kVer];
            
            [xmlWriter writeStartElement:kCmd];
            [xmlWriter writeCharacters:CMDStr];
            [xmlWriter writeEndElement:kCmd];
                        
            [xmlWriter writeStartElement:kIMSI];
            [xmlWriter writeCharacters:IMSIStr];
            [xmlWriter writeEndElement:kIMSI];
            
            [xmlWriter writeStartElement:kTimeStamps];
            [xmlWriter writeCharacters:timeStampStr];
            [xmlWriter writeEndElement:kTimeStamps];
            
            [xmlWriter writeEndElement:kProtocol];
            
            NSMutableString *str = [xmlWriter toString];
            string = str;
            NSLog(@"%@",string);
            return string;
        }
            break;
            
            case kStartLottary://1074-开始抽奖
        {
            NSString *CMDStr       = [NSString stringWithFormat:@"%d",kStartLottary];
            NSString *versionStr   = [PassValueClass sharedIntance].versionStr;
            NSString *IMSIStr      = [PassValueClass sharedIntance].IMSIStr;
            NSString *timeStampStr = [GetPhoneInfo getCurrentTimeStamp];
            
            NSString *areaCodestr  = [PassValueClass sharedIntance].areaCode;
            NSString *stageStr     = [PassValueClass sharedIntance].rewordStage;
            
            
            XMLWriter *xmlWriter = [[XMLWriter alloc] init];
            
            [xmlWriter writeStartElement:kProtocol];
            
            [xmlWriter writeStartElement:kVer];
            [xmlWriter writeCharacters:versionStr];
            [xmlWriter writeEndElement:kVer];
            
            [xmlWriter writeStartElement:kCmd];
            [xmlWriter writeCharacters:CMDStr];
            [xmlWriter writeEndElement:kCmd];
            
            [xmlWriter writeStartElement:kAreaCode];
            [xmlWriter writeCharacters:areaCodestr];
            [xmlWriter writeEndElement:kAreaCode];

            [xmlWriter writeStartElement:kRewordStage];
            [xmlWriter writeCharacters:stageStr];
            [xmlWriter writeEndElement:kRewordStage];

            [xmlWriter writeStartElement:kIMSI];
            [xmlWriter writeCharacters:IMSIStr];
            [xmlWriter writeEndElement:kIMSI];
            
            [xmlWriter writeStartElement:kTimeStamps];
            [xmlWriter writeCharacters:timeStampStr];
            [xmlWriter writeEndElement:kTimeStamps];
            
            [xmlWriter writeEndElement:kProtocol];
            
            NSMutableString *str = [xmlWriter toString];
            string = str;
            NSLog(@"%@",string);
            return string;
        }
            break;
            
        case kConfirmLottary:
        {
            NSString *CMDStr       = [NSString stringWithFormat:@"%d",kConfirmLottary];
            NSString *versionStr   = [PassValueClass sharedIntance].versionStr;
            NSString *IMSIStr      = [PassValueClass sharedIntance].IMSIStr;
            NSString *timeStampStr = [GetPhoneInfo getCurrentTimeStamp];
            
            NSDictionary *dict = [NSDictionary dictionaryWithDictionary:[PassValueClass sharedIntance].lottoryResultDict];
            NSString *idName = [dict objectForKey:kRewordId];

            XMLWriter *xmlWriter = [[XMLWriter alloc] init];
            
            [xmlWriter writeStartElement:kProtocol];
            
            [xmlWriter writeStartElement:kVer];
            [xmlWriter writeCharacters:versionStr];
            [xmlWriter writeEndElement:kVer];
            
            [xmlWriter writeStartElement:kCmd];
            [xmlWriter writeCharacters:CMDStr];
            [xmlWriter writeEndElement:kCmd];
            
            [xmlWriter writeStartElement:kIMSI];
            [xmlWriter writeCharacters:IMSIStr];
            [xmlWriter writeEndElement:kIMSI];
            
            [xmlWriter writeStartElement:kTimeStamps];
            [xmlWriter writeCharacters:timeStampStr];
            [xmlWriter writeEndElement:kTimeStamps];
            
            [xmlWriter writeStartElement:kRewordId];
            [xmlWriter writeCharacters:idName];
            [xmlWriter writeEndElement:kRewordId];

            [xmlWriter writeEndElement:kProtocol];
            
            NSMutableString *str = [xmlWriter toString];
            string = str;
            NSLog(@"%@",string);
            return string;

        }
            break;
            
        case kTaxiAppointment://1035-----预约车辆
        {
            NSString *CMDStr       = [NSString stringWithFormat:@"%d",kTaxiAppointment];
            NSString *versionStr   = [PassValueClass sharedIntance].versionStr;
            NSString *IMSIStr      = [PassValueClass sharedIntance].IMSIStr;
            NSString *timeStampStr = [GetPhoneInfo getCurrentTimeStamp];
            
            NSString *telephone    = [PassValueClass sharedIntance].teleNumStr;
            NSString *lngStr       = [PassValueClass sharedIntance].tmpLngStr;
            NSString *latStr       = [PassValueClass sharedIntance].tmpLatStr;
            NSString *areaCode     = [PassValueClass sharedIntance].areaCode;
            
            NSString *appointTimeStr = [PassValueClass sharedIntance].appointTimeStr;
            NSString *appointDateStr = [PassValueClass sharedIntance].appointDateStr;
            NSString *appointDepartureStr   = [PassValueClass sharedIntance].appointDepartureStr;
            NSString *appointDestinationStr = [PassValueClass sharedIntance].appointDestinationStr;

            NSString *typeStr         = [PassValueClass sharedIntance].typeStr;
            NSString *costDaCheDouStr = [PassValueClass sharedIntance].costDaCheDou;
            
            NSString *time = [NSString  stringWithFormat:@"%@%@",appointDateStr,appointTimeStr];

            XMLWriter *xmlWriter = [[XMLWriter alloc] init];
            
            [xmlWriter writeStartElement:kProtocol];
            
            [xmlWriter writeStartElement:kVer];
            [xmlWriter writeCharacters:versionStr];
            [xmlWriter writeEndElement:kVer];
            
            [xmlWriter writeStartElement:kCmd];
            [xmlWriter writeCharacters:CMDStr];
            [xmlWriter writeEndElement:kCmd];
            
            [xmlWriter writeStartElement:kIMSI];
            [xmlWriter writeCharacters:IMSIStr];
            [xmlWriter writeEndElement:kIMSI];
            
            [xmlWriter writeStartElement:kTelephone];
            [xmlWriter writeCharacters:telephone];
            [xmlWriter writeEndElement:kTelephone];

            [xmlWriter writeStartElement:kDeparture];
            [xmlWriter writeCharacters:appointDepartureStr];
            [xmlWriter writeEndElement:kDeparture];

            [xmlWriter writeStartElement:kDestination];
            [xmlWriter writeCharacters:appointDestinationStr];
            [xmlWriter writeEndElement:kDestination];

            [xmlWriter writeStartElement:kAppointmentTime];
            [xmlWriter writeCharacters:time];
            [xmlWriter writeEndElement:kAppointmentTime];

            [xmlWriter writeStartElement:kCurLatitude];
            [xmlWriter writeCharacters:latStr];
            [xmlWriter writeEndElement:kCurLatitude];

            [xmlWriter writeStartElement:kCurLongitude];
            [xmlWriter writeCharacters:lngStr];
            [xmlWriter writeEndElement:kCurLongitude];
         
            [xmlWriter writeStartElement:kAreaCode];
            [xmlWriter writeCharacters:areaCode];
            [xmlWriter writeEndElement:kAreaCode];

            [xmlWriter writeStartElement:kCoin];
            [xmlWriter writeCharacters:costDaCheDouStr];
            [xmlWriter writeEndElement:kCoin];
            
            [xmlWriter writeStartElement:kType];
            [xmlWriter writeCharacters:typeStr];
            [xmlWriter writeEndElement:kType];

            [xmlWriter writeStartElement:kTimeStamps];
            [xmlWriter writeCharacters:timeStampStr];
            [xmlWriter writeEndElement:kTimeStamps];
            
            [xmlWriter writeEndElement:kProtocol];
            
            NSMutableString *str = [xmlWriter toString];
            string = str;
            NSLog(@"%@",string);
            return string;
        }
            break;
            
        case kDesignatedDriveInfo:
        {
            NSString *CMDStr       = [NSString stringWithFormat:@"%d",kDesignatedDriveInfo];
            NSString *versionStr   = [PassValueClass sharedIntance].versionStr;
            NSString *IMSIStr      = [PassValueClass sharedIntance].IMSIStr;
            NSString *timeStampStr = [GetPhoneInfo getCurrentTimeStamp];
            
            NSString *telephone    = [PassValueClass sharedIntance].teleNumStr;
            NSString *lngStr       = [PassValueClass sharedIntance].tmpLngStr;
            NSString *latStr       = [PassValueClass sharedIntance].tmpLatStr;
            NSString *areaCode     = [PassValueClass sharedIntance].areaCode;
            
            NSString *cllxStr        = [PassValueClass sharedIntance].cllxStr;
            NSString *appointTimeStr = [PassValueClass sharedIntance].appointTimeStr_Daijia;
            NSString *appointDateStr = [PassValueClass sharedIntance].appointDateStr_Daijia;
            NSString *appointDepartureStr   = [PassValueClass sharedIntance].appointDepartureStr_Daijia;
            NSString *appointDestinationStr = [PassValueClass sharedIntance].appointDestinationStr_Daijia;
            
            NSString *time = [NSString  stringWithFormat:@"%@%@",appointDateStr,appointTimeStr];
            
            XMLWriter *xmlWriter = [[XMLWriter alloc] init];
            
            [xmlWriter writeStartElement:kProtocol];
            
            [xmlWriter writeStartElement:kVer];
            [xmlWriter writeCharacters:versionStr];
            [xmlWriter writeEndElement:kVer];
            
            [xmlWriter writeStartElement:kCmd];
            [xmlWriter writeCharacters:CMDStr];
            [xmlWriter writeEndElement:kCmd];
            
            [xmlWriter writeStartElement:kIMSI];
            [xmlWriter writeCharacters:IMSIStr];
            [xmlWriter writeEndElement:kIMSI];
         
            [xmlWriter writeStartElement:kCLLX];
            [xmlWriter writeCharacters:cllxStr];
            [xmlWriter writeEndElement:kCLLX];

            [xmlWriter writeStartElement:kTelephone];
            [xmlWriter writeCharacters:telephone];
            [xmlWriter writeEndElement:kTelephone];
            
            [xmlWriter writeStartElement:kDeparture];
            [xmlWriter writeCharacters:appointDepartureStr];
            [xmlWriter writeEndElement:kDeparture];
            
            [xmlWriter writeStartElement:kDestination];
            [xmlWriter writeCharacters:appointDestinationStr];
            [xmlWriter writeEndElement:kDestination];
            
            [xmlWriter writeStartElement:kAppointmentTime];
            [xmlWriter writeCharacters:time];
            [xmlWriter writeEndElement:kAppointmentTime];
            
            [xmlWriter writeStartElement:kCurLatitude];
            [xmlWriter writeCharacters:latStr];
            [xmlWriter writeEndElement:kCurLatitude];
            
            [xmlWriter writeStartElement:kCurLongitude];
            [xmlWriter writeCharacters:lngStr];
            [xmlWriter writeEndElement:kCurLongitude];
            
            [xmlWriter writeStartElement:kAreaCode];
            [xmlWriter writeCharacters:areaCode];
            [xmlWriter writeEndElement:kAreaCode];
            
            [xmlWriter writeStartElement:kTimeStamps];
            [xmlWriter writeCharacters:timeStampStr];
            [xmlWriter writeEndElement:kTimeStamps];
            
            [xmlWriter writeEndElement:kProtocol];
            
            NSMutableString *str = [xmlWriter toString];
            string = str;
            NSLog(@"%@",string);
            return string;
        }
            break;
            
        case kTaxiAppointmentCancel://1041----取消车辆预约
        {
            NSString *CMDStr       = [NSString stringWithFormat:@"%d",kTaxiAppointmentCancel];
            NSString *versionStr   = [PassValueClass sharedIntance].versionStr;
            NSString *IMSIStr      = [PassValueClass sharedIntance].IMSIStr;
            NSString *timeStampStr = [GetPhoneInfo getCurrentTimeStamp];
            
            NSString *appointmentID = [PassValueClass sharedIntance].tmpAppointmentID;
            
            XMLWriter *xmlWriter = [[XMLWriter alloc] init];
            
            [xmlWriter writeStartElement:kProtocol];
            
            [xmlWriter writeStartElement:kVer];
            [xmlWriter writeCharacters:versionStr];
            [xmlWriter writeEndElement:kVer];
            
            [xmlWriter writeStartElement:kCmd];
            [xmlWriter writeCharacters:CMDStr];
            [xmlWriter writeEndElement:kCmd];
            
            [xmlWriter writeStartElement:kIMSI];
            [xmlWriter writeCharacters:IMSIStr];
            [xmlWriter writeEndElement:kIMSI];
            
            [xmlWriter writeStartElement:kAppointmentID];
            [xmlWriter writeCharacters:appointmentID];
            [xmlWriter writeEndElement:kAppointmentID];

            [xmlWriter writeStartElement:kTimeStamps];
            [xmlWriter writeCharacters:timeStampStr];
            [xmlWriter writeEndElement:kTimeStamps];
            
            [xmlWriter writeEndElement:kProtocol];
            
            NSMutableString *str = [xmlWriter toString];
            string = str;
            NSLog(@"%@",string);
            return string;
        }
            break;
            
        case kDesignatedDriveCancel://1033----取消代驾
        {
            NSString *CMDStr       = [NSString stringWithFormat:@"%d",kDesignatedDriveCancel];
            NSString *versionStr   = [PassValueClass sharedIntance].versionStr;
            NSString *IMSIStr      = [PassValueClass sharedIntance].IMSIStr;
            NSString *timeStampStr = [GetPhoneInfo getCurrentTimeStamp];
            
            NSString *appointmentID = [PassValueClass sharedIntance].tmpThirdDriverID;

            XMLWriter *xmlWriter = [[XMLWriter alloc] init];
            
            [xmlWriter writeStartElement:kProtocol];
            
            [xmlWriter writeStartElement:kVer];
            [xmlWriter writeCharacters:versionStr];
            [xmlWriter writeEndElement:kVer];
            
            [xmlWriter writeStartElement:kCmd];
            [xmlWriter writeCharacters:CMDStr];
            [xmlWriter writeEndElement:kCmd];
            
            [xmlWriter writeStartElement:kIMSI];
            [xmlWriter writeCharacters:IMSIStr];
            [xmlWriter writeEndElement:kIMSI];
            
            [xmlWriter writeStartElement:kThirdDrivingID];
            [xmlWriter writeCharacters:appointmentID];
            [xmlWriter writeEndElement:kThirdDrivingID];

            [xmlWriter writeStartElement:kTimeStamps];
            [xmlWriter writeCharacters:timeStampStr];
            [xmlWriter writeEndElement:kTimeStamps];
            
            [xmlWriter writeEndElement:kProtocol];
            
            NSMutableString *str = [xmlWriter toString];
            string = str;
            NSLog(@"%@",string);
            return string;
        }
            break;
            
            
        case kBillUnevaluated:     //1055---未评价订单
        {
            NSString *CMDStr       = [NSString stringWithFormat:@"%d",kBillUnevaluated];
            NSString *versionStr   = [PassValueClass sharedIntance].versionStr;
            NSString *IMSIStr      = [PassValueClass sharedIntance].IMSIStr;
            NSString *timeStampStr = [GetPhoneInfo getCurrentTimeStamp];
            
            NSString *pageIndexStr = [NSString stringWithFormat:@"%d",[PassValueClass sharedIntance].pageIndex];
            NSString *evaluateStr  = @"0";
            
            XMLWriter *xmlWriter = [[XMLWriter alloc] init];
            
            [xmlWriter writeStartElement:kProtocol];
            
            [xmlWriter writeStartElement:kVer];
            [xmlWriter writeCharacters:versionStr];
            [xmlWriter writeEndElement:kVer];
            
            [xmlWriter writeStartElement:kCmd];
            [xmlWriter writeCharacters:CMDStr];
            [xmlWriter writeEndElement:kCmd];
            
            [xmlWriter writeStartElement:kIMSI];
            [xmlWriter writeCharacters:IMSIStr];
            [xmlWriter writeEndElement:kIMSI];
            
            [xmlWriter writeStartElement:kPageIndex];
            [xmlWriter writeCharacters:pageIndexStr];
            [xmlWriter writeEndElement:kPageIndex];
            
            [xmlWriter writeStartElement:kEvaluateStatus];
            [xmlWriter writeCharacters:evaluateStr];
            [xmlWriter writeEndElement:kEvaluateStatus];
            
            [xmlWriter writeStartElement:kTimeStamps];
            [xmlWriter writeCharacters:timeStampStr];
            [xmlWriter writeEndElement:kTimeStamps];
            
            [xmlWriter writeEndElement:kProtocol];
            
            NSMutableString *str = [xmlWriter toString];
            string = str;
            NSLog(@"%@",string);
            return string;
        }
            break;
        
        case kBillEvaluation://1059用户评价
        {
            NSString *CMDStr       = [NSString stringWithFormat:@"%d",kBillEvaluation];
            NSString *versionStr   = [PassValueClass sharedIntance].versionStr;
            NSString *IMSIStr      = [PassValueClass sharedIntance].IMSIStr;
            NSString *timeStampStr = [GetPhoneInfo getCurrentTimeStamp];

            NSString *requestType    = [PassValueClass sharedIntance].requestType;
            NSString *evaluateStr    = [PassValueClass sharedIntance].evaluateStr;
            NSString *evaluateType   = [PassValueClass sharedIntance].evaluateType;
            NSString *requestID      = [PassValueClass sharedIntance].requestID;
            
            XMLWriter *xmlWriter = [[XMLWriter alloc] init];
            
            [xmlWriter writeStartElement:kProtocol];
            
            [xmlWriter writeStartElement:kVer];
            [xmlWriter writeCharacters:versionStr];
            [xmlWriter writeEndElement:kVer];
            
            [xmlWriter writeStartElement:kCmd];
            [xmlWriter writeCharacters:CMDStr];
            [xmlWriter writeEndElement:kCmd];
            
            [xmlWriter writeStartElement:kIMSI];
            [xmlWriter writeCharacters:IMSIStr];
            [xmlWriter writeEndElement:kIMSI];
            
            [xmlWriter writeStartElement:kRequestID];
            [xmlWriter writeCharacters:requestID];
            [xmlWriter writeEndElement:kRequestID];
            
            [xmlWriter writeStartElement:kEvaluate];
            [xmlWriter writeCharacters:evaluateType];
            [xmlWriter writeEndElement:kEvaluate];
            
            [xmlWriter writeStartElement:kRequestType];
            [xmlWriter writeCharacters:requestType];
            [xmlWriter writeEndElement:kRequestType];
            
            [xmlWriter writeStartElement:kEvaluateContent];
            [xmlWriter writeCharacters:evaluateStr];
            [xmlWriter writeEndElement:kEvaluateContent];

            [xmlWriter writeStartElement:kTimeStamps];
            [xmlWriter writeCharacters:timeStampStr];
            [xmlWriter writeEndElement:kTimeStamps];
            
            [xmlWriter writeEndElement:kProtocol];
            
            NSMutableString *str = [xmlWriter toString];
            string = str;
            NSLog(@"%@",string);
            return string;
        }
            break;
            
        case kUserComplain:  //1061用户差评
        {
            NSString *CMDStr       = [NSString stringWithFormat:@"%d",kUserComplain];
            NSString *versionStr   = [PassValueClass sharedIntance].versionStr;
            NSString *IMSIStr      = [PassValueClass sharedIntance].IMSIStr;
            NSString *timeStampStr = [GetPhoneInfo getCurrentTimeStamp];
            
            NSString *requestType    = [PassValueClass sharedIntance].requestType;
            NSString *evaluateStr    = [PassValueClass sharedIntance].evaluateStr;
//            NSString *evaluateType   = [PassValueClass sharedIntance].evaluateType;
            NSString *requestID      = [PassValueClass sharedIntance].requestID;
            
            XMLWriter *xmlWriter = [[XMLWriter alloc] init];
            
            [xmlWriter writeStartElement:kProtocol];
            
            [xmlWriter writeStartElement:kVer];
            [xmlWriter writeCharacters:versionStr];
            [xmlWriter writeEndElement:kVer];
            
            [xmlWriter writeStartElement:kCmd];
            [xmlWriter writeCharacters:CMDStr];
            [xmlWriter writeEndElement:kCmd];
            
            [xmlWriter writeStartElement:kIMSI];
            [xmlWriter writeCharacters:IMSIStr];
            [xmlWriter writeEndElement:kIMSI];
            
            [xmlWriter writeStartElement:kRequestID];
            [xmlWriter writeCharacters:requestID];
            [xmlWriter writeEndElement:kRequestID];
                        
            [xmlWriter writeStartElement:kRequestType];
            [xmlWriter writeCharacters:requestType];
            [xmlWriter writeEndElement:kRequestType];
            
            [xmlWriter writeStartElement:kAppealContent];
            [xmlWriter writeCharacters:evaluateStr];
            [xmlWriter writeEndElement:kAppealContent];
            
            [xmlWriter writeStartElement:kTimeStamps];
            [xmlWriter writeCharacters:timeStampStr];
            [xmlWriter writeEndElement:kTimeStamps];
            
            [xmlWriter writeEndElement:kProtocol];
            
            NSMutableString *str = [xmlWriter toString];
            string = str;
            NSLog(@"%@",string);
            return string;
        }
            break;
        case kBillEvaluated:     //1057---已评价订单
        {
            NSString *CMDStr       = [NSString stringWithFormat:@"%d",kBillEvaluated];
            NSString *versionStr   = [PassValueClass sharedIntance].versionStr;
            NSString *IMSIStr      = [PassValueClass sharedIntance].IMSIStr;
            NSString *timeStampStr = [GetPhoneInfo getCurrentTimeStamp];
            
            NSString *pageIndexStr = [NSString stringWithFormat:@"%d",[PassValueClass sharedIntance].pageIndex_Finished];
            NSString *evaluateStr  = @"1";
            
            XMLWriter *xmlWriter = [[XMLWriter alloc] init];
            
            [xmlWriter writeStartElement:kProtocol];
            
            [xmlWriter writeStartElement:kVer];
            [xmlWriter writeCharacters:versionStr];
            [xmlWriter writeEndElement:kVer];
            
            [xmlWriter writeStartElement:kCmd];
            [xmlWriter writeCharacters:CMDStr];
            [xmlWriter writeEndElement:kCmd];
            
            [xmlWriter writeStartElement:kIMSI];
            [xmlWriter writeCharacters:IMSIStr];
            [xmlWriter writeEndElement:kIMSI];
            
            [xmlWriter writeStartElement:kPageIndex];
            [xmlWriter writeCharacters:pageIndexStr];
            [xmlWriter writeEndElement:kPageIndex];
            
            [xmlWriter writeStartElement:kEvaluateStatus];
            [xmlWriter writeCharacters:evaluateStr];
            [xmlWriter writeEndElement:kEvaluateStatus];
            
            [xmlWriter writeStartElement:kTimeStamps];
            [xmlWriter writeCharacters:timeStampStr];
            [xmlWriter writeEndElement:kTimeStamps];
            
            [xmlWriter writeEndElement:kProtocol];
            
            NSMutableString *str = [xmlWriter toString];
            string = str;
            NSLog(@"%@",string);
            return string;
        }
            break;

        case kUserFeedback:      //1023---用户反馈
        {
            NSString *CMDStr       = [NSString stringWithFormat:@"%d",kUserFeedback];
            NSString *versionStr   = [PassValueClass sharedIntance].versionStr;
            NSString *IMSIStr      = [PassValueClass sharedIntance].IMSIStr;
            NSString *timeStampStr = [GetPhoneInfo getCurrentTimeStamp];

            NSString *feedbackStr = [PassValueClass sharedIntance].feedbackStr;
            
            XMLWriter *xmlWriter = [[XMLWriter alloc] init];
            
            [xmlWriter writeStartElement:kProtocol];
            
            [xmlWriter writeStartElement:kVer];
            [xmlWriter writeCharacters:versionStr];
            [xmlWriter writeEndElement:kVer];
            
            [xmlWriter writeStartElement:kCmd];
            [xmlWriter writeCharacters:CMDStr];
            [xmlWriter writeEndElement:kCmd];
            
            [xmlWriter writeStartElement:kIMSI];
            [xmlWriter writeCharacters:IMSIStr];
            [xmlWriter writeEndElement:kIMSI];
            
            [xmlWriter writeStartElement:kOptions];
            [xmlWriter writeCharacters:feedbackStr];
            [xmlWriter writeEndElement:kOptions];
                        
            [xmlWriter writeStartElement:kTimeStamps];
            [xmlWriter writeCharacters:timeStampStr];
            [xmlWriter writeEndElement:kTimeStamps];
            
            [xmlWriter writeEndElement:kProtocol];
            
            NSMutableString *str = [xmlWriter toString];
            string = str;
            NSLog(@"%@",string);
            return string;

        }
            break;
            
            
        case kBillFinish://1049 -- 用户结单
        {
            NSString *CMDStr       = [NSString stringWithFormat:@"%d",kBillFinish];
            NSString *versionStr   = [PassValueClass sharedIntance].versionStr;
            NSString *IMSIStr      = [PassValueClass sharedIntance].IMSIStr;
            NSString *timeStampStr = [GetPhoneInfo getCurrentTimeStamp];

            NSString *orderNoStr   = [NSString stringWithFormat:@"%d",[PassValueClass sharedIntance].orderNO];
            NSLog(@"%@",orderNoStr);
            XMLWriter *xmlWriter = [[XMLWriter alloc] init];
            
            [xmlWriter writeStartElement:kProtocol];
            
            [xmlWriter writeStartElement:kVer];
            [xmlWriter writeCharacters:versionStr];
            [xmlWriter writeEndElement:kVer];
            
            [xmlWriter writeStartElement:kCmd];
            [xmlWriter writeCharacters:CMDStr];
            [xmlWriter writeEndElement:kCmd];
            
            [xmlWriter writeStartElement:kIMSI];
            [xmlWriter writeCharacters:IMSIStr];
            [xmlWriter writeEndElement:kIMSI];
            
            [xmlWriter writeStartElement:kRequestID];
            [xmlWriter writeCharacters:orderNoStr];
            [xmlWriter writeEndElement:kRequestID];
            
            [xmlWriter writeStartElement:kTimeStamps];
            [xmlWriter writeCharacters:timeStampStr];
            [xmlWriter writeEndElement:kTimeStamps];
            
            [xmlWriter writeEndElement:kProtocol];
            
            NSMutableString *str = [xmlWriter toString];
            string = str;
            NSLog(@"%@",str);
            return string;
        }
            break;
            
        case kSysInfo:   //1071 -- 系统消息
        {
            NSString *CMDStr       = [NSString stringWithFormat:@"%d",kSysInfo];
            NSString *versionStr   = [PassValueClass sharedIntance].versionStr;
            NSString *IMSIStr      = [PassValueClass sharedIntance].IMSIStr;
            NSString *timeStampStr = [GetPhoneInfo getCurrentTimeStamp];

            XMLWriter *xmlWriter = [[XMLWriter alloc] init];
            
            [xmlWriter writeStartElement:kProtocol];
            
            [xmlWriter writeStartElement:kVer];
            [xmlWriter writeCharacters:versionStr];
            [xmlWriter writeEndElement:kVer];
            
            [xmlWriter writeStartElement:kCmd];
            [xmlWriter writeCharacters:CMDStr];
            [xmlWriter writeEndElement:kCmd];
            
            [xmlWriter writeStartElement:kIMSI];
            [xmlWriter writeCharacters:IMSIStr];
            [xmlWriter writeEndElement:kIMSI];
                        
            [xmlWriter writeStartElement:kTimeStamps];
            [xmlWriter writeCharacters:timeStampStr];
            [xmlWriter writeEndElement:kTimeStamps];
            
            [xmlWriter writeEndElement:kProtocol];
            
            NSMutableString *str = [xmlWriter toString];
            string = str;
            return string;

        }
            break;
            
        case kTaxiAppointmentCheck://1037 -- 车辆预约查看
        {
            NSString *CMDStr       = [NSString stringWithFormat:@"%d",kTaxiAppointmentCheck];
            NSString *versionStr   = [PassValueClass sharedIntance].versionStr;
            NSString *IMSIStr      = [PassValueClass sharedIntance].IMSIStr;
            NSString *timeStampStr = [GetPhoneInfo getCurrentTimeStamp];
            
            XMLWriter *xmlWriter = [[XMLWriter alloc] init];
            
            [xmlWriter writeStartElement:kProtocol];
            
            [xmlWriter writeStartElement:kVer];
            [xmlWriter writeCharacters:versionStr];
            [xmlWriter writeEndElement:kVer];
            
            [xmlWriter writeStartElement:kCmd];
            [xmlWriter writeCharacters:CMDStr];
            [xmlWriter writeEndElement:kCmd];
            
            [xmlWriter writeStartElement:kIMSI];
            [xmlWriter writeCharacters:IMSIStr];
            [xmlWriter writeEndElement:kIMSI];
            
            [xmlWriter writeStartElement:kTimeStamps];
            [xmlWriter writeCharacters:timeStampStr];
            [xmlWriter writeEndElement:kTimeStamps];
            
            [xmlWriter writeEndElement:kProtocol];
            
            NSMutableString *str = [xmlWriter toString];
            string = str;
            return string;
            

        }
            break;
            
        case kDesignatedDriveCheck://1029 -- 车辆代驾查看
        {
            NSString *CMDStr       = [NSString stringWithFormat:@"%d",kDesignatedDriveCheck];
            NSString *versionStr   = [PassValueClass sharedIntance].versionStr;
            NSString *IMSIStr      = [PassValueClass sharedIntance].IMSIStr;
            NSString *timeStampStr = [GetPhoneInfo getCurrentTimeStamp];
            
            XMLWriter *xmlWriter = [[XMLWriter alloc] init];
            
            [xmlWriter writeStartElement:kProtocol];
            
            [xmlWriter writeStartElement:kVer];
            [xmlWriter writeCharacters:versionStr];
            [xmlWriter writeEndElement:kVer];
            
            [xmlWriter writeStartElement:kCmd];
            [xmlWriter writeCharacters:CMDStr];
            [xmlWriter writeEndElement:kCmd];
            
            [xmlWriter writeStartElement:kIMSI];
            [xmlWriter writeCharacters:IMSIStr];
            [xmlWriter writeEndElement:kIMSI];
            
            [xmlWriter writeStartElement:kTimeStamps];
            [xmlWriter writeCharacters:timeStampStr];
            [xmlWriter writeEndElement:kTimeStamps];
            
            [xmlWriter writeEndElement:kProtocol];
            
            NSMutableString *str = [xmlWriter toString];
            string = str;
//            NSLog(@"%@",str);
            return string;
        }
            break;
            
        case kPilotCity://1063-体验城市查询
        {
            NSString *CMDStr       = [NSString stringWithFormat:@"%d",kPilotCity];
            NSString *versionStr   = [PassValueClass sharedIntance].versionStr;
            NSString *IMSIStr      = [PassValueClass sharedIntance].IMSIStr;
            NSString *timeStampStr = [GetPhoneInfo getCurrentTimeStamp];
            
            XMLWriter *xmlWriter = [[XMLWriter alloc] init];
            
            [xmlWriter writeStartElement:kProtocol];
            
            [xmlWriter writeStartElement:kVer];
            [xmlWriter writeCharacters:versionStr];
            [xmlWriter writeEndElement:kVer];
            
            [xmlWriter writeStartElement:kCmd];
            [xmlWriter writeCharacters:CMDStr];
            [xmlWriter writeEndElement:kCmd];
            
            [xmlWriter writeStartElement:kIMSI];
            [xmlWriter writeCharacters:IMSIStr];
            [xmlWriter writeEndElement:kIMSI];
            
            [xmlWriter writeStartElement:kTimeStamps];
            [xmlWriter writeCharacters:timeStampStr];
            [xmlWriter writeEndElement:kTimeStamps];
            
            [xmlWriter writeEndElement:kProtocol];
            
            NSMutableString *str = [xmlWriter toString];
            string = str;
            return string;
        }
            break;
            
    #pragma mark - 3.0 新增接口
            
        case kRequestTradeList: // --请求购买列表
        {
            NSString *CMDStr       = [NSString stringWithFormat:@"%d",kRequestTradeList];
            NSString *versionStr   = [PassValueClass sharedIntance].versionStr;
            NSString *IMSIStr      = [PassValueClass sharedIntance].IMSIStr;
            NSString *timeStampStr = [GetPhoneInfo getCurrentTimeStamp];
            
            XMLWriter *xmlWriter = [[XMLWriter alloc] init];
            
            [xmlWriter writeStartElement:kProtocol];
            
            [xmlWriter writeStartElement:kVer];
            [xmlWriter writeCharacters:versionStr];
            [xmlWriter writeEndElement:kVer];
            
            [xmlWriter writeStartElement:kCmd];
            [xmlWriter writeCharacters:CMDStr];
            [xmlWriter writeEndElement:kCmd];
            
            [xmlWriter writeStartElement:kIMSI];
            [xmlWriter writeCharacters:IMSIStr];
            [xmlWriter writeEndElement:kIMSI];
            
            [xmlWriter writeStartElement:kTimeStamps];
            [xmlWriter writeCharacters:timeStampStr];
            [xmlWriter writeEndElement:kTimeStamps];
            
            [xmlWriter writeEndElement:kProtocol];
            
            NSMutableString *str = [xmlWriter toString];
            string = str;
            return string;

        }
            break;
            
        case kRequetTradeID:// --申请充值
        {
            NSString *CMDStr       = [NSString stringWithFormat:@"%d",kRequetTradeID];
            NSString *versionStr   = [PassValueClass sharedIntance].versionStr;
            NSString *IMSIStr      = [PassValueClass sharedIntance].IMSIStr;
            NSString *timeStampStr = [GetPhoneInfo getCurrentTimeStamp];
            
            NSString *indexStr = [PassValueClass sharedIntance].choosedIndexStr;
            
            XMLWriter *xmlWriter = [[XMLWriter alloc] init];
            
            [xmlWriter writeStartElement:kProtocol];
            
            [xmlWriter writeStartElement:kVer];
            [xmlWriter writeCharacters:versionStr];
            [xmlWriter writeEndElement:kVer];
            
            [xmlWriter writeStartElement:kCmd];
            [xmlWriter writeCharacters:CMDStr];
            [xmlWriter writeEndElement:kCmd];
            
            [xmlWriter writeStartElement:kIMSI];
            [xmlWriter writeCharacters:IMSIStr];
            [xmlWriter writeEndElement:kIMSI];
            
            [xmlWriter writeStartElement:kIndex];
            [xmlWriter writeCharacters:indexStr];
            [xmlWriter writeEndElement:kIndex];
            
            [xmlWriter writeStartElement:kTimeStamps];
            [xmlWriter writeCharacters:timeStampStr];
            [xmlWriter writeEndElement:kTimeStamps];
            
            [xmlWriter writeEndElement:kProtocol];
            
            NSMutableString *str = [xmlWriter toString];
            string = str;
            NSLog(@"kRequetTradeID = %@",string);
            return string;
        }
            break;
            
        case kRequetDaCheDou:
        {
            NSString *CMDStr       = [NSString stringWithFormat:@"%d",kRequetDaCheDou];
            NSString *versionStr   = [PassValueClass sharedIntance].versionStr;
            NSString *IMSIStr      = [PassValueClass sharedIntance].IMSIStr;
            NSString *timeStampStr = [GetPhoneInfo getCurrentTimeStamp];
            
            XMLWriter *xmlWriter = [[XMLWriter alloc] init];
            
            [xmlWriter writeStartElement:kProtocol];
            
            [xmlWriter writeStartElement:kVer];
            [xmlWriter writeCharacters:versionStr];
            [xmlWriter writeEndElement:kVer];
            
            [xmlWriter writeStartElement:kCmd];
            [xmlWriter writeCharacters:CMDStr];
            [xmlWriter writeEndElement:kCmd];
            
            [xmlWriter writeStartElement:kIMSI];
            [xmlWriter writeCharacters:IMSIStr];
            [xmlWriter writeEndElement:kIMSI];
                        
            [xmlWriter writeStartElement:kTimeStamps];
            [xmlWriter writeCharacters:timeStampStr];
            [xmlWriter writeEndElement:kTimeStamps];
            
            [xmlWriter writeEndElement:kProtocol];
            
            NSMutableString *str = [xmlWriter toString];
            string = str;
            return string;
        }
            break;
            
        case kUserUpLoadNum:
        {
            NSString *CMDStr       = [NSString stringWithFormat:@"%d",kUserUpLoadNum];
            NSString *versionStr   = [PassValueClass sharedIntance].versionStr;
            NSString *IMSIStr      = [PassValueClass sharedIntance].IMSIStr;
            NSString *timeStampStr = [GetPhoneInfo getCurrentTimeStamp];
            
            XMLWriter *xmlWriter = [[XMLWriter alloc] init];
            
            [xmlWriter writeStartElement:kProtocol];
            
            [xmlWriter writeStartElement:kVer];
            [xmlWriter writeCharacters:versionStr];
            [xmlWriter writeEndElement:kVer];
            
            [xmlWriter writeStartElement:kCmd];
            [xmlWriter writeCharacters:CMDStr];
            [xmlWriter writeEndElement:kCmd];
            
            [xmlWriter writeStartElement:kIMSI];
            [xmlWriter writeCharacters:IMSIStr];
            [xmlWriter writeEndElement:kIMSI];
            
            [xmlWriter writeStartElement:kTimeStamps];
            [xmlWriter writeCharacters:timeStampStr];
            [xmlWriter writeEndElement:kTimeStamps];
            
            
            [xmlWriter writeStartElement:kTelephoneList];

            NSArray *array = [NSArray arrayWithArray:[PassValueClass sharedIntance].userUploadArray];
            for (int i = 0; i< array.count; i++)
            {
                NSString *str = [array objectAtIndex:i];
                [xmlWriter writeStartElement:kTelephoneNo];
                [xmlWriter writeCharacters:str];
                [xmlWriter writeEndElement:kTelephoneNo];
            }
            
            [xmlWriter writeEndElement:kTelephoneList];

            
            [xmlWriter writeEndElement:kProtocol];
            
            NSMutableString *str = [xmlWriter toString];
            string = str;
            NSLog(@"%@",str);
            return string;
        }
            break;
            
        case kTianZeUid:
        {
            NSString *CMDStr       = [NSString stringWithFormat:@"%d",kTianZeUid];
            NSString *versionStr   = [PassValueClass sharedIntance].versionStr;
            NSString *IMSIStr      = [PassValueClass sharedIntance].IMSIStr;
            NSString *timeStampStr = [GetPhoneInfo getCurrentTimeStamp];
            
            XMLWriter *xmlWriter = [[XMLWriter alloc] init];
            
            [xmlWriter writeStartElement:kProtocol];
            
            [xmlWriter writeStartElement:kVer];
            [xmlWriter writeCharacters:versionStr];
            [xmlWriter writeEndElement:kVer];
            
            [xmlWriter writeStartElement:kCmd];
            [xmlWriter writeCharacters:CMDStr];
            [xmlWriter writeEndElement:kCmd];
            
            [xmlWriter writeStartElement:kIMSI];
            [xmlWriter writeCharacters:IMSIStr];
            [xmlWriter writeEndElement:kIMSI];
            
            [xmlWriter writeStartElement:kTimeStamps];
            [xmlWriter writeCharacters:timeStampStr];
            [xmlWriter writeEndElement:kTimeStamps];
            
            [xmlWriter writeEndElement:kProtocol];
            
            NSMutableString *str = [xmlWriter toString];
            string = str;
            return string;
        }
            break;
            
        case kUploadTianZeUid:
        {
            NSString *CMDStr       = [NSString stringWithFormat:@"%d",kUploadTianZeUid];
            NSString *versionStr   = [PassValueClass sharedIntance].versionStr;
            NSString *IMSIStr      = [PassValueClass sharedIntance].IMSIStr;
            NSString *timeStampStr = [GetPhoneInfo getCurrentTimeStamp];
            
            NSString *uidStr = [PassValueClass sharedIntance].tzUidStr;
            
            XMLWriter *xmlWriter = [[XMLWriter alloc] init];
            
            [xmlWriter writeStartElement:kProtocol];
            
            [xmlWriter writeStartElement:kVer];
            [xmlWriter writeCharacters:versionStr];
            [xmlWriter writeEndElement:kVer];
            
            [xmlWriter writeStartElement:kCmd];
            [xmlWriter writeCharacters:CMDStr];
            [xmlWriter writeEndElement:kCmd];
            
            [xmlWriter writeStartElement:kIMSI];
            [xmlWriter writeCharacters:IMSIStr];
            [xmlWriter writeEndElement:kIMSI];
            
            [xmlWriter writeStartElement:kTimeStamps];
            [xmlWriter writeCharacters:timeStampStr];
            [xmlWriter writeEndElement:kTimeStamps];
            
            [xmlWriter writeStartElement:kTianZeUidStr];
            [xmlWriter writeCharacters:uidStr];
            [xmlWriter writeEndElement:kTianZeUidStr];
            
            [xmlWriter writeEndElement:kProtocol];
            
            NSMutableString *str = [xmlWriter toString];
            string = str;
            return string;
        }
            break;
            
        case kUploadZhaoCheBaoOrder:
        {
            NSString *CMDStr       = [NSString stringWithFormat:@"%d",kUploadZhaoCheBaoOrder];
            
            NSString *versionStr   = [PassValueClass sharedIntance].versionStr;
            NSString *IMSIStr      = [PassValueClass sharedIntance].IMSIStr;
            NSString *timeStampStr = [GetPhoneInfo getCurrentTimeStamp];
            
            NSString *suidStr     = [[PassValueClass sharedIntance].zhaoCheBaoDict objectForKey:kTid];
            NSString *phoneStr    = [[PassValueClass sharedIntance].zhaoCheBaoDict objectForKey:kPhone];
            NSString *cityStr     = [[PassValueClass sharedIntance].zhaoCheBaoDict objectForKey:kCity];
            NSString *areaCodeStr = [[PassValueClass sharedIntance].zhaoCheBaoDict objectForKey:kAreaCode];
            NSString *typeStr     = [[PassValueClass sharedIntance].zhaoCheBaoDict objectForKey:kType];
            
            NSString *curStr      = [[PassValueClass sharedIntance].zhaoCheBaoDict objectForKey:kFrom];
            NSString *desStr      = [[PassValueClass sharedIntance].zhaoCheBaoDict objectForKey:kTo];
            NSString *user_lat    = [[PassValueClass sharedIntance].zhaoCheBaoDict objectForKey:kFromLat];
            NSString *user_lng    = [[PassValueClass sharedIntance].zhaoCheBaoDict objectForKey:kFromLon];
            NSString *driver_lat  = [[PassValueClass sharedIntance].zhaoCheBaoDict objectForKey:kToLat];
            NSString *driver_lon  = [[PassValueClass sharedIntance].zhaoCheBaoDict objectForKey:kToLon];

            
            NSString *disStr      = [[PassValueClass sharedIntance].zhaoCheBaoDict objectForKey:kDistance];
            NSString *vnameStr    = [[PassValueClass sharedIntance].zhaoCheBaoDict objectForKey:kCarId];
            NSString *driverNameStr  = [[PassValueClass sharedIntance].zhaoCheBaoDict objectForKey:kDriverName];
            NSString *carNoStr    = [[PassValueClass sharedIntance].zhaoCheBaoDict objectForKey:kCarNo];
            NSString *modelStr    = [[PassValueClass sharedIntance].zhaoCheBaoDict objectForKey:kCarType];
            NSString *companyStr  = [[PassValueClass sharedIntance].zhaoCheBaoDict objectForKey:kCompany];
            
            XMLWriter *xmlWriter = [[XMLWriter alloc] init];
            
            [xmlWriter writeStartElement:kProtocol];
            
            [xmlWriter writeStartElement:kVer];
            [xmlWriter writeCharacters:versionStr];
            [xmlWriter writeEndElement:kVer];
            
            [xmlWriter writeStartElement:kCmd];
            [xmlWriter writeCharacters:CMDStr];
            [xmlWriter writeEndElement:kCmd];
            
            [xmlWriter writeStartElement:kIMSI];
            [xmlWriter writeCharacters:IMSIStr];
            [xmlWriter writeEndElement:kIMSI];
            
            [xmlWriter writeStartElement:kTimeStamps];
            [xmlWriter writeCharacters:timeStampStr];
            [xmlWriter writeEndElement:kTimeStamps];
            
            [xmlWriter writeStartElement:kTid];
            [xmlWriter writeCharacters:suidStr];
            [xmlWriter writeEndElement:kTid];
            
            [xmlWriter writeStartElement:kPhone];
            [xmlWriter writeCharacters:phoneStr];
            [xmlWriter writeEndElement:kPhone];
            
            [xmlWriter writeStartElement:kCity];
            [xmlWriter writeCharacters:cityStr];
            [xmlWriter writeEndElement:kCity];
            
            [xmlWriter writeStartElement:kAreaCode];
            [xmlWriter writeCharacters:areaCodeStr];
            [xmlWriter writeEndElement:kAreaCode];
            
            [xmlWriter writeStartElement:kType];
            [xmlWriter writeCharacters:typeStr];
            [xmlWriter writeEndElement:kType];
            
            [xmlWriter writeStartElement:kFrom];
            [xmlWriter writeCharacters:curStr];
            [xmlWriter writeEndElement:kFrom];
            
            [xmlWriter writeStartElement:kTo];
            [xmlWriter writeCharacters:desStr];
            [xmlWriter writeEndElement:kTo];
            
            [xmlWriter writeStartElement:kFromLat];
            [xmlWriter writeCharacters:user_lat];
            [xmlWriter writeEndElement:kFromLat];
            
            [xmlWriter writeStartElement:kFromLon];
            [xmlWriter writeCharacters:user_lng];
            [xmlWriter writeEndElement:kFromLon];
            
            [xmlWriter writeStartElement:kToLat];
            [xmlWriter writeCharacters:driver_lat];
            [xmlWriter writeEndElement:kToLat];
            
            [xmlWriter writeStartElement:kToLon];
            [xmlWriter writeCharacters:driver_lon];
            [xmlWriter writeEndElement:kToLon];
            
            [xmlWriter writeStartElement:kDistance];
            [xmlWriter writeCharacters:disStr];
            [xmlWriter writeEndElement:kDistance];
            
            [xmlWriter writeStartElement:kCarId];
            [xmlWriter writeCharacters:vnameStr];
            [xmlWriter writeEndElement:kCarId];
            
            [xmlWriter writeStartElement:kDriverName];
            [xmlWriter writeCharacters:driverNameStr];
            [xmlWriter writeEndElement:kDriverName];
            
            [xmlWriter writeStartElement:kCarNo];
            [xmlWriter writeCharacters:carNoStr];
            [xmlWriter writeEndElement:kCarNo];
            
            [xmlWriter writeStartElement:kCarType];
            [xmlWriter writeCharacters:modelStr];
            [xmlWriter writeEndElement:kCarType];
            
            [xmlWriter writeStartElement:kCompany];
            [xmlWriter writeCharacters:companyStr];
            [xmlWriter writeEndElement:kCompany];
            
            [xmlWriter writeEndElement:kProtocol];
            
            NSMutableString *str = [xmlWriter toString];
            string = str;
            return string;

        }
            break;
            
        default:
            return nil;
            break;
    }
}

+ (NSMutableData *)getWantedData:(NSString *)string   //NSString 转换成 NSData
{
    NSData *requestData = [string dataUsingEncoding:NSUTF8StringEncoding];
	
	//获取字符串字节数组的长度
	int datalength=[requestData length];
	
	uint8_t len[4];
	len[3] = (Byte)((datalength>>24)&0xFF);
	len[2] = (Byte)((datalength>>16)&0xFF);
	len[1] = (Byte)((datalength>>8)&0xFF);
	len[0] = (Byte)(datalength&0xFF);
    
	NSMutableData *dataToSend = [NSMutableData dataWithBytes:len length:4];
	//拼接字符串
	[dataToSend appendData:requestData];
    return dataToSend;
}

@end
